Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
window.addEventListener("message", getData); doesn't work in safari?

I am sending a postmessage from js script to iframe which is in react

// listensting to postMessage() function in react // React File

useEffect(() => {

function getData(e) {
  console.log("inside function");
  var origin = e.origin || e.originalEvent.origin;
  console.log("origin", origin);

  if (typeof e.data == "object" && "shopDomain" in e.data) {
    console.log(e.data);
  } else {
    console.log("not able to catch data");
  }
}
window.addEventListener("message", getData, false);
return () => {
  window.removeEventListener("message", getData, false);
};
}, []);

// JS File

let win = iframe.contentWindow;
win.contentWindow.postMessage(
  {
    customerId: customerId_rs,
    parentLocation: window.location.host,
  },
  "*"
);

Looked at various sites but can't find any solution. Have spent almost 10 hours at this any help would be appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

it seems like safari dont have the full support but it should support if you check the browser support of addEventListener you can see

  • options.passive parameter defaults to true for touchstart and touchmove events
  • options.passive parameter defaults to true for wheel and mousewheel events
  • options.signal parameter

these do not have support. you can read more about it here

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda